package com.tencent.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tencent.entity.Pagination;
import com.tencent.entity.Physical;
import com.tencent.mapper.PhysicalMapper;
import com.tencent.service.PhysicalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author King
 * @Date 2022/8/16 10:31
 * @Version 1.0.0
 */
@Service
public class PhysicalServiceImpl implements PhysicalService {
    @Autowired
    private PhysicalMapper physicalMapper;

    @Override
    public PageInfo<Physical> findByName(Pagination pagination) {
        //设置分页参数
        PageHelper.startPage(pagination.getCurrentPage(),pagination.getPageSize());
        //查询
        List<Physical> allName = physicalMapper.findAllName(pagination.getQueryString());
        return new PageInfo<>(allName);
    }

    @Override
    public int updateNumberOrAdd(String fileNumber,String report) {
        int i = physicalMapper.updateByFileName(fileNumber, report);


        return i;
    }
}
